home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / snip9503 / bitops.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-14  |  384 b   |  15 lines

  1. /*
  2. **  Bit set, clear, and test operations
  3. **
  4. **  public domain snippet by Bob Stout
  5. */
  6.  
  7. typedef enum {ERROR = -1, FALSE, TRUE} LOGICAL;
  8.  
  9. #define BOOL(x) (!(!(x)))
  10.  
  11. #define BitSet(arg,posn) ((arg) | (1L << (posn)))
  12. #define BitClr(arg,posn) ((arg) & ~(1L << (posn)))
  13. #define BitTst(arg,posn) BOOL((arg) & (1L << (posn)))
  14. #define BitFlp(arg,posn) ((arg) ^ (1L << (posn)))
  15.